from socket import socket,AF_INET, SOCK_DGRAM

udp_client = socket(AF_INET, SOCK_DGRAM)
# udp_client.connect(('127.0.0.1', 8087))

while True:
    data = input("请输入要问的问题：")
    print(data)
    udp_client.sendto(data.encode('utf-8'), ('127.0.0.1', 8087))
    if  data == 'bye':
        break
    res, addr = udp_client.recvfrom(1024)
    print("接收到的回答", res.decode('utf-8'))


udp_client.close()
